<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>生命钩子</title>
    <script src="./vue.js"></script>
</head>
<body>

<div id="app">
    <input type="text" v-model="message">
</div>

<script>
    let vm = new Vue({
        el: "#app",
        data: {
            message: "hello"
        },
        beforeCreate() {
            console.log('beforeCreate')
        },
        created() {
            console.log('created')
            alert('created')
            // 准备数据。比如说 访问服务器
        },
        beforeMount() {
            console.log('beforeMount')
        },
        mounted() {
            console.log('mounted')
            alert('mounted')
            // 获取页面中渲染的数据
        },
        beforeUpdate() {
            console.log('beforeUpdate')
        },
        updated() {
            console.log('updated')
        },
        beforeDestroy() {
            console.log('beforeDestroy')
        },
        destroyed() {
            console.log('destroyed')
        }
    })
</script>

</body>
</html>